package com;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.AbstractFactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class CurrentApplicationContextFactoryBean extends AbstractFactoryBean<ApplicationContext> implements ApplicationContextAware {

	private ApplicationContext applicationContext;

	@Override
	protected ApplicationContext createInstance() throws Exception {
		return this.applicationContext;
	}

	@Override
	public Class<?> getObjectType() {
		return ApplicationContext.class;
	}

	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		this.applicationContext = applicationContext;
	}
}
